import ToolRequest from '@/base/newToolAxios';
import RequestOption from '@/base/RequestOption';
import { getActToolUrl } from '@/base/constant';
const tr = new ToolRequest();

export default class majorScore_dao {
  params = (majorScore: any) => {
    return {
      grade_1_1_1: majorScore.value[0].level,
      grade_1_1_2: majorScore.value[1].level,
      grade_1_2_1: majorScore.value[2].level,
      grade_2_1_1: majorScore.value[3].level,
      grade_2_1_2: majorScore.value[4].level,
      grade_2_1_3: majorScore.value[5].level,
      grade_2_1_4: majorScore.value[6].level,
      grade_2_2_1: majorScore.value[7].level,
      grade_2_2_2: majorScore.value[8].level,
      grade_2_2_3: majorScore.value[9].level,
      grade_2_2_4: majorScore.value[10].level,
      grade_3_1_1: majorScore.value[11].level,
      grade_3_1_2: majorScore.value[12].level,
      grade_4_1_1: majorScore.value[13].level,
      grade_4_1_2: majorScore.value[14].level,
      grade_4_2_1: majorScore.value[15].level,
      grade_4_2_2: majorScore.value[16].level,
      grade_4_2_3: majorScore.value[17].level,
      grade_4_2_4: majorScore.value[18].level,
      grade_4_2_5: majorScore.value[19].level,
      grade_4_3_1: majorScore.value[20].level,
      grade_4_4_1: majorScore.value[21].level,
      grade_4_4_2: majorScore.value[22].level,
      grade_4_4_3: majorScore.value[23].level,
      grade_5_1_1: majorScore.value[24].level,
      grade_5_1_2: majorScore.value[25].level,
      grade_5_2_1: majorScore.value[26].level,
      grade_5_2_2: majorScore.value[27].level,
      grade_5_3_1: majorScore.value[28].level,
      grade_5_3_2: majorScore.value[29].level,
      remark_1_1_1: majorScore.value[0].remark,
      remark_1_1_2: majorScore.value[1].remark,
      remark_1_2_1: majorScore.value[2].remark,
      remark_2_1_1: majorScore.value[3].remark,
      remark_2_1_2: majorScore.value[4].remark,
      remark_2_1_3: majorScore.value[5].remark,
      remark_2_1_4: majorScore.value[6].remark,
      remark_2_2_1: majorScore.value[7].remark,
      remark_2_2_2: majorScore.value[8].remark,
      remark_2_2_3: majorScore.value[9].remark,
      remark_2_2_4: majorScore.value[10].remark,
      remark_3_1_1: majorScore.value[11].remark,
      remark_3_1_2: majorScore.value[12].remark,
      remark_4_1_1: majorScore.value[13].remark,
      remark_4_1_2: majorScore.value[14].remark,
      remark_4_2_1: majorScore.value[15].remark,
      remark_4_2_2: majorScore.value[16].remark,
      remark_4_2_3: majorScore.value[17].remark,
      remark_4_2_4: majorScore.value[18].remark,
      remark_4_2_5: majorScore.value[19].remark,
      remark_4_3_1: majorScore.value[20].remark,
      remark_4_4_1: majorScore.value[21].remark,
      remark_4_4_2: majorScore.value[22].remark,
      remark_4_4_3: majorScore.value[23].remark,
      remark_5_1_1: majorScore.value[24].remark,
      remark_5_1_2: majorScore.value[25].remark,
      remark_5_2_1: majorScore.value[26].remark,
      remark_5_2_2: majorScore.value[27].remark,
      remark_5_3_1: majorScore.value[28].remark,
      remark_5_3_2: majorScore.value[29].remark
    };
  };

  async saveMajorScore(majorCode: any, conclusion: any, majorScore: any, handlersName: any) {
    const ro = new RequestOption();
    return await tr.post(
      getActToolUrl(),
      {
        action: 'saveMajorScore',
        majorCode: majorCode,
        conclusion: conclusion,
        ...this.params(majorScore),
        handlersName: handlersName
      },
      ro
    );
  }

  async selectByMajorCode(majorCode: any) {
    const ro = new RequestOption();
    return await tr.post(
      getActToolUrl(),
      {
        action: 'selectByMajorCode',
        majorCode: majorCode,
      },
      ro
    );
  }

  /**
   * 审核通过
   * @param majorCode 专业代码
   * @returns 
   */
  async approve(majorCode: any) {
    const ro = new RequestOption();
    return await tr.post(
      getActToolUrl(),
      {
        action: 'approve',
        majorCode: majorCode
      },
      ro
    );
  }

  /**
   * 审核不通过
   * @param majorCode 专业代码
   * @returns 
   */
  async disApprove(majorCode: any) {
    const ro = new RequestOption();
    return await tr.post(
      getActToolUrl(),
      {
        action: 'disApprove',
        majorCode: majorCode
      },
      ro
    );
  }

}
